package cn.wolfcode.mapper;

import cn.wolfcode.domain.Employee;
import cn.wolfcode.domain.Permission;
import cn.wolfcode.result.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Description: 员工持久层接口
 * @Author: 伍家钰
 * @Date: 2020/7/11 19:40
 * @Version: 1.0
 */
public interface EmployeeMapper {

    /**
     * 删除
     *
     * @param id :
     * @return :
     */
    int deleteByPrimaryKey(Long id);

    /**
     * 保存
     *
     * @param record:
     * @return :
     */
    int insert(Employee record);

    /**
     * 根据id查询
     *
     * @param id :
     * @return :
     */
    Employee selectByPrimaryKey(Long id);

    /**
     * 查询全部
     *
     * @return :
     */
    List<Employee> selectAll();

    int updateByPrimaryKey(Employee record);

    int selectCount(QueryObject qo);

    List<Employee> selectForList(QueryObject qo);

    /**
     * 往中间表中插入数据
     *
     * @param employeeId :员工id
     * @param roleId     :角色id
     */
    void insertRelation(@Param("employeeId") Long employeeId, @Param("roleId") Long roleId);

    /**
     * 根据员工id删除中间表
     *
     * @param id: 员工id
     */
    void deleteRelation(Long id);

    /**
     * 登入功能
     *
     * @param username
     * @param password
     * @return
     */
    Employee loginByUsernameAndPassword(@Param("username") String username, @Param("password") String password);

    void updateForPassword(@Param("id") Long id, @Param("newPassword") String newPassword);

    void batchDelete(@Param("ids") Long[] ids);

    Employee selectByName(String name);

    void status(@Param("id") Long id, @Param("status") boolean status);

    List<Employee> selectBysn(String[] sn);
}